//
//  WBDemoViewController.swift
//  传智微博
//
//  Created by 郑亚伟 on 16/11/4.
//  Copyright © 2016年 郑亚伟. All rights reserved.
//

import UIKit

class WBDemoViewController: WBBaseViewController {

    override func viewDidLoad() {
        super.viewDidLoad()
        //设置标题
        title = "第\(navigationController?.childViewControllers.count ?? 0)个"
    }
    
    //MARK:进入下一界面
    @objc func showNext(){
        let vc = WBDemoViewController()
        navigationController?.pushViewController(vc, animated: true)
    }
    
    //MARK: 返回上一界面   返回上一级界面在WBNavigationController中设置
//    @objc func back(){
//        navigationController?.popViewController(animated: true)
//    }
    
}

extension WBDemoViewController{
    override func setupUI(){
        super.setupUI()
       // navigationItem.rightBarButtonItem = UIBarButtonItem(title: "下一个", style: .plain, target: self, action: #selector(showNext))
//        let btn = UIButton.cz_textButton("下一个", fontSize: 16, normalColor: UIColor.darkGray, highlightedColor: UIColor.orange)
//        btn?.addTarget(self, action: #selector(showNext), for: .touchUpInside)
//        navigationItem.rightBarButtonItem = UIBarButtonItem(customView: btn!)
        //navItem这是父类（WBBaseViewController）的属性  在父类中自定义导航栏
        navItem.rightBarButtonItem = UIBarButtonItem(title: "下一个", fontSize: 16, target: self, action: #selector(showNext))
        //navItem.leftBarButtonItem = UIBarButtonItem(title: "返回", fontSize: 16, target: self, action: #selector(back))
    }
}
